package thread1009;

public class ThreadDemo {
    public static void main(String[] args) {
        Thread m1=new MyThread();
        Runnable thread2 = new MyThread2();
        Thread m2 = new Thread(thread2);
        m1.start();
        m2.start();
    }
}
class MyThread extends Thread{
    @Override
    public void run() {
        for (int i = 0; i < 1000; i++) {
            System.out.println("add");
        }
    }
}
class MyThread2 implements Runnable{
    @Override
    public void run() {
        for (int i = 0; i <1000 ; i++) {
            System.out.println("sub");
        }
    }
}

